import axios from 'axios'

const instance = axios.create({
    baseURL: 'http://127.0.0.1:8000/',
    timeout: 3000,
});
instance.interceptors.request.use(config=>{
    const token = localStorage.getItem('token');
    if (token) {
      config.headers.Authorization = token;
    }
    return config
},(error:any)=>{
    console.log(error);
})
instance.interceptors.response.use(response=>{
    return response.data
},(error:any)=>{
    console.log(error);
})

export default instance